﻿namespace Shanda.DevFx.Security.Web.Pages
{
    using Shanda.DevFx;
    using Shanda.DevFx.Data.Utils;
    using Shanda.DevFx.Security;
    using Shanda.DevFx.Security.Web;
    using System;
    using System.Reflection;
    using System.Web.UI.WebControls;

    public class MainPage : Shanda.DevFx.Security.Web.BasePage
    {
        protected Label lblVersion;

        protected override void InitData()
        {
            base.InitData();
            string format = "<font color=gray>\r\n\t\t\t\t　　框架产品版本号：{0}<br>\r\n\t\t\t\t　　　　核心模块版本号：{1}<br>\r\n\t\t\t\t　　　　权限模块版本号：{2}<br>\r\n\t\t\t\t　　　　页面模块版本号：{3}<br>\r\n\t\t\t\t　　　　数据访问版本号：{4}<br>\r\n\t\t\t</font>";
            string product = null;
            AssemblyProductAttribute[] customAttributes = (AssemblyProductAttribute[]) typeof(Framework).Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
            if ((customAttributes != null) && (customAttributes.Length > 0))
            {
                product = customAttributes[0].Product;
            }
            else
            {
                product = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
            this.lblVersion.set_Text(string.Format(format, new object[] { product, typeof(Framework).Assembly.GetName().Version.ToString(), typeof(Securitor).Assembly.GetName().Version.ToString(), typeof(Shanda.DevFx.Security.Web.BasePage).Assembly.GetName().Version.ToString(), typeof(SqlHelper).Assembly.GetName().Version.ToString() }));
        }

        private void InitializeComponent()
        {
        }

        protected override void OnInit(EventArgs e)
        {
            this.InitializeComponent();
            base.OnInit(e);
        }
    }
}

